package com.luoye.lj.wstool.wsdm;

import com.luoye.lj.wstool.generator.ICodeGenerator;
import com.luoye.lj.wstool.wsdm.entity.WsdtEntity;
import com.luoye.lj.wstool.wsdm.entity.WsdtField;

/*
 * Created with IntelliJ IDEA.
 * User: Dave Liu
 * Date: 2016/4/26
 * Time: 15:43
 * To change this template use File | Settings | File Templates.
 */
public class EntityMapCodeGenerator implements ICodeGenerator {
    private WsdtEntity wsdtEntity;

    public EntityMapCodeGenerator(WsdtEntity wsdtEntity) {
        this.wsdtEntity = wsdtEntity;
    }

    @Override
    public String codeGenerate() {
        String code="";
        if(this.wsdtEntity!=null){
            if(this.wsdtEntity.getFieldList()!=null){
                for(WsdtField wsdtField:this.wsdtEntity.getFieldList()){
                    code += "<result column=\""+wsdtField.getColumnName()+"\" property=\""+wsdtField.getFieldName()+"\"/>\n";
                }
            }
        }
        return code;
    }
}
